package org.example.handler;

import lombok.extern.slf4j.Slf4j;
import org.example.util.JsonResult;
import org.example.util.ResultTool;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @Auther:Liu
 * @Testname:GlobalExceptionHandler
 * @Date:2025/8/13 15:26
 */
@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {

    @ExceptionHandler(UserNameNotFontException.class)
    public JsonResult userNameNotFontException(Throwable e) {
        return ResultTool.fail(201, e.getMessage());
    }

    @ExceptionHandler(PasswordNotFoundException.class)
    public JsonResult passwordNotFontException(Throwable e) {
        return ResultTool.fail(202, e.getMessage());
    }
}
